package com.sinopec.handdevice.presenter

import com.sinopec.basemodule.api.BaseModuleApi
import com.sinopec.basemodule.http.CommonObserver
import com.sinopec.basemodule.http.ExceptionEngine
import com.sinopec.handdevice.contract.StockInDetailContract

/**
 * @author lwj
 * @ClassName: StockInDetailPresenter
 * @Description: 入库详情
 */
class StockInDetailPresenter(view: StockInDetailContract.View) :
    StockInDetailContract.Presenter(view) {

    /**
     * 确认入库完成
     */
    override fun confirmStockInOrderFinish(id: Long) {
        val resultObservable = BaseModuleApi.confirmStockInOrderFinish(id)
        toSubscribe(resultObservable, object : CommonObserver<Any?>(mView.context) {
            override fun onNext(s: Any) {
                mView.context.finish()
                mView.showMessage("操作成功！")
            }

            override fun onError(t: ExceptionEngine.ResponseThrowable) {
                mView.context.finish()
                mView.showMessage("操作成功！")
                //mView.showMessage(t.message)
            }
        })
    }
}